/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.Controller;

import com.DAO.AcervoConteudoDAO;
import com.thoughtworks.xstream.XStream;
import java.util.List;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;

/**
 *
 * @author Fellipe
 */
@WebService(serviceName = "AcervoConteudo")
public class AcervoConteudo {

    private XStream xstream = new XStream();
    private AcervoConteudoDAO ac = new AcervoConteudoDAO();
    
    @WebMethod(operationName = "create")
    public void createAcervoConteudo() {
        
    }
    
    @WebMethod(operationName = "read")
    public String readAcervoConteudo(int chaveConteudo) {
        return toXMLAcervoConteudo(ac.readUm(chaveConteudo));
    }
    
    @WebMethod(operationName = "update")
    public void updateAcervoConteudo() {
        
    }
    
    @WebMethod(operationName = "delete")
    public void deleteAcervoConteudo() {
        
    }
    
    @WebMethod(operationName = "busca")
    public String buscaNomeAcervoContedo(String busca, int chave) {
        
        return toXMLAcervoConteudoList(ac.busca(busca, chave));
        
    }
    
    private String toXMLAcervoConteudo(com.Model.AcervoConteudo acervoConteudo) {
        
        return xstream.toXML(acervoConteudo);
        
    }
    
    private String toXMLAcervoConteudoList(List<com.Model.AcervoConteudo> lista) {
        
        return xstream.toXML(lista);
        
    }

    private com.Model.AcervoConteudo fromXMLAcervoConteudo(String xml) {
        
        return (com.Model.AcervoConteudo) xstream.fromXML(xml);
        
    }  
    
}
